# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Content.V21.Model.ReturnPolicy do
  @moduledoc """
  Return policy resource.

  ## Attributes

  *   `country` (*type:* `String.t`, *default:* `nil`) - Required. The country of sale where the return policy is applicable.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Identifies what kind of resource this is. Value: the fixed string "`content#returnPolicy`"
  *   `label` (*type:* `String.t`, *default:* `nil`) - Required. The user-defined label of the return policy. For the default policy, use the label "default".
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. The name of the policy as shown in Merchant Center.
  *   `nonFreeReturnReasons` (*type:* `list(String.t)`, *default:* `nil`) - Return reasons that will incur return fees.
  *   `policy` (*type:* `GoogleApi.Content.V21.Model.ReturnPolicyPolicy.t`, *default:* `nil`) - Required. The policy.
  *   `returnPolicyId` (*type:* `String.t`, *default:* `nil`) - Return policy ID generated by Google.
  *   `returnShippingFee` (*type:* `GoogleApi.Content.V21.Model.Price.t`, *default:* `nil`) - The return shipping fee that will apply to non free return reasons.
  *   `seasonalOverrides` (*type:* `list(GoogleApi.Content.V21.Model.ReturnPolicySeasonalOverride.t)`, *default:* `nil`) - An optional list of seasonal overrides.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :country => String.t() | nil,
          :kind => String.t() | nil,
          :label => String.t() | nil,
          :name => String.t() | nil,
          :nonFreeReturnReasons => list(String.t()) | nil,
          :policy => GoogleApi.Content.V21.Model.ReturnPolicyPolicy.t() | nil,
          :returnPolicyId => String.t() | nil,
          :returnShippingFee => GoogleApi.Content.V21.Model.Price.t() | nil,
          :seasonalOverrides =>
            list(GoogleApi.Content.V21.Model.ReturnPolicySeasonalOverride.t()) | nil
        }

  field(:country)
  field(:kind)
  field(:label)
  field(:name)
  field(:nonFreeReturnReasons, type: :list)
  field(:policy, as: GoogleApi.Content.V21.Model.ReturnPolicyPolicy)
  field(:returnPolicyId)
  field(:returnShippingFee, as: GoogleApi.Content.V21.Model.Price)

  field(:seasonalOverrides,
    as: GoogleApi.Content.V21.Model.ReturnPolicySeasonalOverride,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.Content.V21.Model.ReturnPolicy do
  def decode(value, options) do
    GoogleApi.Content.V21.Model.ReturnPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V21.Model.ReturnPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
